-
Notifications
You must be signed in to change notification settings - Fork 344
Drop old quantization flows #3115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3115
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 6 PendingAs of commit 04ea5f8 with merge base c96f2dd ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about inlining _int8wo_api
, _int8da_int8w_api
, _int4wo_api
? They are used only once across codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think that's fine if they're only used in benchmarks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also cc @jainapurva, can you take a look at the benchmark changes?
print("_int8da_int8w_api") | ||
|
||
for M, N, K in all_shapes: | ||
_bench_quantized_tensor_subclass_perf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporarily updated to use new APIs 2 times to fix CI, but maybe we can update _bench_quantized_tensor_subclass_perf
to compare only original vs. new quantization flows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @namgyu-youn, thanks for working on this. I think it looks good overall, but seems like we removed some things outside the scope of #2745, like smoothquant. Can you please add these back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think that's fine if they're only used in benchmarks
@@ -1,266 +0,0 @@ | |||
# Copyright (c) Meta Platforms, Inc. and affiliates. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @namgyu-youn I don't think we want to remove smoothquant? This wasn't part of the issue: #2745. Can you add these back?
return wrapper | ||
|
||
|
||
class SmoothquantUnitTest(unittest.TestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, please add the smoothquant tests back
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SmoothQuant API side, they (torchao/quantization/smoothquant.py
& torchao/quantization/prototype/smoothquant/
) are just a two different implementations, so we can revert them.
But in tests side, because we dropped
from torchao.quantization.subclass import (
Int4WeightOnlyQuantizedLinearWeight,
Int8DynamicallyQuantizedLinearWeight,
Int8WeightOnlyQuantizedLinearWeight,
)
,
tests (SmoothquantUnitTest
) can't be maintained. So my suggestion is, how about dropping the old SmoothQuant API also in this PR? The new API also resolved #1639 and has better structure I think
Int8DynamicallyQuantizedLinearWeight, | ||
Int8WeightOnlyQuantizedLinearWeight, | ||
from torchao.quantization.subclass import ( | ||
QuantizedLinearWeightBase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't we remove this class in this PR? Seems we need to delete this import completely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks for pointing it out
return y | ||
|
||
|
||
def dynamically_quantize_per_channel(x, quant_min, quant_max, target_dtype): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @namgyu-youn I don't think this is part of the scope, can you add this function back? The issue #2745 is only referring to everything in subclass.py
, dynamic_quant.py
, and weight_only.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted; it was misunderstanding while checking api structure.
Summary:
This PR drops old quantization flows:
Applies corresponding change in other parts for removing old quantization flows:
Test plan: test/integration/test_integration.py